﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleAppDemo.ArithmeticSore
{
    public class InsertSore
    {
        public static void Entry()
        {
            var t=new int[8] { 8,7,6,5,4,3,2,1};
            Insert(t);
            for (int i = 0; i < t.Length; i++)
            {
                Console.WriteLine(t[i]);
            }

        }
        public static void Insert(int[] arr)
        {
            for (int i = 0; i < arr.Length-1; i++)
            {
                if (arr[i]>arr[i+1])
                {
                    for (int j = i; j < 0; j--)
                    {
                        var tempJ = arr[j];
                        if (arr[j]>arr[j+1])
                        {
                            arr[j] = arr[j + 1];
                            arr[j + 1] = tempJ;
                            continue;
                        }
                        break;
                    }
                }
            }
        }
    }
}
